package com.diankangwo.factory.service.impl;

import com.diankangwo.factory.dao.TdCategoryPropertyMapper;
import com.diankangwo.factory.entity.TdCategoryProperty;
import com.diankangwo.factory.service.TdCategoryPropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("TdCategoryPropertyService")
public class TdCategoryPropertyServiceImpl implements TdCategoryPropertyService {

    @Autowired
    TdCategoryPropertyMapper mapper;

    /**
     * 添加
     */
    @Transactional
    public void save(TdCategoryProperty tdCategoryProperty){
        mapper.insert(tdCategoryProperty);
    }

    /**
     * 删除
     * @param id
     */
    @Override
    @Transactional
    public void deleteByCommodityId(int id) {
        mapper.deleteByCommodityId(id);
    }

    @Override
    public int deleteByCategoryId(Integer id) {
        return mapper.deleteByCategoryId(id);
    }

    @Override
    public List<TdCategoryProperty> queryByCategoryId(Integer categoryid) {
        return mapper.queryByCategoryId(categoryid);
    }

    ;

}
